import { INCREMENT, DECREMENT } from "./constant";
const initState = 0;
const handleCount = (preState = initState, action) => {
  const { type, data } = action;
  switch (type) {
    case INCREMENT:
      return preState + data * 1;
    case DECREMENT:
      return preState - data * 1;
    default:
      return preState;
  }
};
export default handleCount;
